Skip to main content

All Questions

4votes
3answers
426views

Find the first missing positive integer in an array of integers

The problem is the one explained in Given an unsorted integer array, find the first missing positive integer Given an unsorted integer array, find the first missing positive integer. For ...
user2761431's user avatar
3votes
1answer
3kviews

Circuit builder that calculates resistance/current/voltage

I am somewhat new to programming. I've written a program that takes user input accepting voltages and resistors, and calculating total resistance/current/voltage in the circuit. I am looking for ways ...
Michael Sinclair's user avatar
1vote
1answer
329views

Rearrange an array in place such that the first and last halves are interleaved

Given an array of n elements in the following format { a1, a2, a3, a4, ….., an/2, b1, b2, b3, b4, …., bn/2 }. The task is shuffle the array to {a1, b1, a2, b2, a3, b3, ……, an/2, bn/2 } without ...
Anirudh Thatipelli's user avatar
2votes
3answers
305views

Three Numbers in Java

Given three positive numbers A, B, and C. Find the number of positive integers less than D that are divisible by either of A, B or C. Input format The 1st argument given is an Integer A. ...
Anirudh Thatipelli's user avatar
1vote
2answers
627views

Subset Sums in Java

Given an array of integers, print sums of all subsets in it. Output should be printed in increasing order of sums. Input : arr[] = {2, 3} Output: 0 2 3 5 Input : ...
Anirudh Thatipelli's user avatar
1vote
3answers
6kviews

Sort all even numbers in ascending order and then sort all odd numbers in Descending order Java

Given an array of integers (both odd and even), the task is to sort them in such a way that the first part of the array contains odd numbers sorted in descending order, rest portion contains even ...
Anirudh Thatipelli's user avatar
6votes
5answers
3kviews

Sort an array of 0s, 1s and 2s in Java

Write a program to sort an array of 0's,1's and 2's in ascending order. Input: The first line contains an integer 'T' denoting the total number of test cases. In each test cases, First ...
Anirudh Thatipelli's user avatar
2votes
6answers
1kviews

Alone in a Couple implementation in Java

In a party everyone is in couple except one. People who are in couple have same numbers. Find out the person who is not in couple. Input: The first line contains an integer \$T\$ denoting ...
Anirudh Thatipelli's user avatar
0votes
1answer
906views

Reversing the vowels in a String

Given a string, reverse only the vowels present in it and print the resulting string. Input: First line of the input file contains an integer T denoting the number of test ...
Anirudh Thatipelli's user avatar
2votes
1answer
175views

Anagram checking implementation

Given two strings, check whether two given strings are anagram of each other or not. An anagram of a string is another string that contains same characters, only the order of characters can be ...
Anirudh Thatipelli's user avatar
3votes
2answers
522views

Non repeating character in Java

Given a string s consisting of lowercase Latin Letters, find the first non repeating character in s. Input: The first line contains T denoting the number of testcases. Then follows ...
Anirudh Thatipelli's user avatar
1vote
2answers
962views

Star Elements implementation in Java

Given an unsorted array. The task is to find all the star and super star elements in the array. Star are those elements which are strictly greater than all the elements on its right side. Super ...
Anirudh Thatipelli's user avatar
2votes
2answers
503views

Greater on the right side in Java

Given an array of integers, replace every element with the next greatest element (greatest element on the right side) in the array. Since there is no element next to the last element, replace it ...
Anirudh Thatipelli's user avatar
0votes
2answers
3kviews

Count the number of occurences of X's within a range in Java

Given an integer X within the range of 0 to 9, and given two positive integers as upper and lower bounds respectively, find the number of times X occurs as a digit in an integer within the ...
Anirudh Thatipelli's user avatar
1vote
2answers
179views

Count total set bits

Im am solving Count total set bits: Find the sum of all bits from numbers 1 to N. Input: The first line of input contains an integer T denoting the number of test cases. The first line ...
Anirudh Thatipelli's user avatar

153050per page
close